package com.example.futureai.config.wbe;

import com.example.futureai.config.wbe.filter.JwtFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: WebFilterConfig
 * @Description:
 * @Author: YourName
 * @Date: 2025/2/27
 */

@Configuration
public class WebFilterConfig {

    //过滤器
    @Bean
    public FilterRegistrationBean<JwtFilter> jwtFilter() {
        final FilterRegistrationBean<JwtFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new JwtFilter());
        registrationBean.addUrlPatterns("/*");
        // 设置Filter的执行顺序(默认为最低优先级)
        registrationBean.setOrder(1);
        return registrationBean;
    }
}
